package graphics;

/*
 * To change this template, choose Tools | Templates and open the template in
 * the editor.
 */
/**
 *
 * @author icdev
 */
import java.awt.Color;
import java.awt.Container;

public class GraphicsEngin {

    public static void changeBackground(Container con, int cValue) {
        if (cValue >= 0 && cValue <= 100) {
            int rgb = new Double(cValue / 100d * 255d).intValue();
            con.setBackground(new Color(rgb, rgb, rgb));
        }
    }

    public static Color getComplementaryColor(Color color) {
        if (color == null) {
            return null;
        }
        int red = color.getRed();
        red = getOppositeNumber(red);
        int green = color.getGreen();
        green = getOppositeNumber(green);
        int blue = color.getBlue();
        blue = getOppositeNumber(blue);
        return new Color(red, green, blue);
    }

    private static int getOppositeNumber(int num) {
        return (num ^ 0x70) & 0xff;
    }
}
